#! /bin/bash
connectionString=$1
dataPath=$2

if [ -f './LoadStockInfo.bad' ]; then
     echo "Clear log file"
     rm ./DB/ETL/LoadStockInfo.bad
fi

sqlldr userid=$connectionString skip=1 control=./LoadStockInfo.ctl data=$dataPath bad=./LoadStockInfo.bad discard=./LoadStockInfo.dis log=./LoadStockInfo.log
 
if [ -f './LoadStockInfo.bad' ]; then
     echo "failed to load data"
     exit 1
fi
echo "Load done!"
